<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib  prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="redis" uri="http://www.shopjsp.com/redisTag/functions" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="basePath" value="${redis:getSysConfig('base_path_back')}"/>
<c:set var="uploadPath" value="${redis:getSysConfig('uploadFileVisitRoot')}"/>
<script type="text/javascript">
    /**
     * 审核商品答疑
     */
	<shiro:hasPermission name="back_gotoProductInfoQuestionPage_update">
    function auditInfo() {
        /**获取选中行的id**/
        var selectedRow = $("#tt").bootstrapTable('getSelections');
        if (selectedRow.length == 1) {
            var id = selectedRow[0].productInfoQuestionId;
            $("#btn_audit").attr("data-target", "#auditInfoModal");/**选中了记录后才可打开对应的模态框**/
            $.ajax({
                type: "POST",
                dataType: "JSON",
                url: "${basePath}/back/productInfoQuestion/getShopProductQuestionInfo.sjson",
                data: {productInfoQuestionId: id},
                success: function (result) {
                    var data = JSON.parse(result.data);
                    /**重置详情页中所有html展示信息**/
                    resetDetailTable("detailTableAudit");
                    /**设置展示信息**/
                    /**隐藏域**/
                    $("#a_productInfoQuestionId").val(selectedRow[0].productInfoQuestionId);
                    /**可见表单控件**/
                    $("#a_productName").html(data[0].productName);
                    $("#a_customerName").html(data[0].customerName);
                    <c:forEach items="${redis:getBasicKeyBook('askType')}" var="kb">
                    if(data[0].askType==${kb.value}){
                        $("#a_askType").html("${kb.name}");
                    }
                    </c:forEach>
                    $("#a_askQuestion").html(data[0].askQuestion);

                    if(data[0].shopStatus==1){
                        $("#a_shopStatus").html("<font class='color_002'>未通过审核</font>");
                    }else if(data[0].shopStatus==2){
                        $("#a_shopStatus").html("<font class='color_001'>通过审核</font>");
                    }else if(data[0].shopStatus==3){
                        $("#a_shopStatus").html("<font class='color_003'>待审核</font>");
                    }

                    $("#status_" + data[0].status).attr("checked", "checked");
                }
            });
        }else {
            $("#btn_audit").attr("data-target", "");/**没有选中记录不可打开模态框**/
            showMsg("请选择一行记录！");
        }
    }
	</shiro:hasPermission>

    /**
     * 表单异步提交
     */
    function submitForm_auditProductQuestion(){
        var options = {
            url: $("#form_auditProductQuestion").attr("action"),
            type : "post",
            dataType:"json",
            success : function(data) {
                if(data.success==true){
                    /** 先重置查询框的值**/
                    resetQueryForm();
                    /** 重新刷新列表数据**/
                    $("#tt").bootstrapTable('refresh');
                    /** 自动关闭弹出模态框窗口**/
                    $(".close").click();
                    showMsg("保存成功！");
                }else{
                    showMsg("保存失败！");
                }
            }
        };
        $("#form_auditProductQuestion").ajaxSubmit(options);
    }
</script>

<!--审核商品答疑模态框（Modal） -->
<div class="modal fade" id="auditInfoModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
	<div class="modal-dialog" style="width:70%">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
				<h5 class="modal-title" id="myModalLabel">审核商品答疑</h5>
			</div>
			<div class="modal-body">
				<form id="form_auditProductQuestion" method="post" action="${basePath}/back/productInfoQuestion/auditProductQuestion.sjson">
					<input id="a_productInfoQuestionId" type="hidden" name="productInfoQuestionId" value=""/>
					<table id="detailTableAudit" align="center" class="addOrEditTable table-bordered table" style="width:100%;">
						<tr>
							<td class="toright_td" width="150px">商品名称:</td>
							<td class="toleft_td">&nbsp;&nbsp;<span id="a_productName"></span></td>
						</tr>
						<tr>
							<td class="toright_td" width="150px">会员名称:</td>
							<td class="toleft_td" >&nbsp;&nbsp;<span id="a_customerName"></span></td>
						</tr>
						<tr>
							<td class="toright_td" width="150px">咨询类型:</td>
							<td class="toleft_td">&nbsp;&nbsp;<span id="a_askType"></span></td>
						</tr>
						<tr>
							<td class="toright_td" width="150px">咨询内容:</td>
							<td class="toleft_td">&nbsp;&nbsp;<span id="a_askQuestion"></span></td>
						</tr>
						<tr>
							<td class="toright_td" width="150px">店铺审核:</td>
							<td class="toleft_td">&nbsp;&nbsp;<span id="a_shopStatus"></span></td>
						</tr>
						<tr>
							<td class="toright_td" width="150px"><span style="color:red">* </span>审核状态:&nbsp;&nbsp;</td>
							<td  class="toleft_td">
								<label class="checkbox-inline">
									<input type="radio" name="status" id="status_1" class="radioInput" value="1" checked="checked">&nbsp;未通过
								</label>
								<label class="checkbox-inline">
									<input type="radio" name="status" id="status_2" class="radioInput" value="2"  >&nbsp;已通过
								</label>
								<label class="checkbox-inline">
									<input type="radio" name="status" id="status_3" class="radioInput" value="3"  >&nbsp;待审核
								</label>
							</td>
						</tr>
					</table>
				</form>
			</div>
			<div class="modal-footer">
				<button type="button" id="validateBtn" class="btn btn-primary" onclick="submitForm_auditProductQuestion()">保存</button>
				<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			</div>
		</div><!-- /.modal-content -->
	</div><!-- /.modal -->
</div>
